SUBROUTINE readin 
! Copyright (C) 2009-2010 W. Wang 
! License: This file is distributed under the terms of the GNU General Public License.
! Description: ! 
! Revision histoty: Created May 2010  
! Input/output Parameters: 

USE cellinfo
IMPLICIT NONE
!Local variables  
INTEGER :: i,j
INTEGER :: err
CHARACTER(256) :: block
OPEN(50,FILE='eskit.in',ACTION='READ',STATUS='OLD',FORM='FORMATTED',IOSTAT=err)
CALL err_open(err,"panda.in")

DO
READ(50,*,IOSTAT=err) block
!write(*,*)block
IF (err.NE.0) EXIT

! read input parameters 
SELECT CASE(TRIM(block))
!CASE('tasks')
CASE('atoms')
READ(50,*,IOSTAT=err)atoms
  IF (AllOCATED(atoms_info)) DEALLOCATE(atoms_info)
  ALLOCATE(atoms_info(atoms))

  DO i=1,atoms
     READ(50,*,IOSTAT=err) atoms_info(i)%atom_symbol,(atoms_info(i)%atom_pos(j),j=1,3)
     CALL err_read(err,"atoms")
  END DO

CASE('cell')
  DO i=1,3
  READ(50,*,IOSTAT=err)(cell_vector(i,j),j=1,3)
  CALL err_read(err,"cell")
  END DO
CASE('cutoff')
  READ(50,*,IOSTAT=err)cutoff
  CALL err_read(err,"cutoff")
CASE('kmesh')
  READ(50,*,IOSTAT=err)(kmesh(i),i=1,3)
  CALL err_read(err,"kmesh")

CASE DEFAULT
END SELECT

END DO
CLOSE(50)

RETURN
END SUBROUTINE
